rm(list = ls())

## 

library(tidyverse)

## Load saved results

soep <- read_rds("data/soep_results.rds")

# Figure 5: effect on identification w/ left-leaning parties ----

p2 <- soep %>% 
  filter(exclude_state == 'State excluded' & 
           outcome == 'left_total') %>% 
  ggplot(aes(end_year, estimate * 100)) +
  geom_errorbar(aes(ymin = conf.low * 100, 
                    max = conf.high * 100),
                width = 0) +
  geom_hline(yintercept = 0, linetype = 'dotted') +
  geom_point(shape = 21, fill = 'white', size = 2) + 

  theme_bw() +
  ylab('RD estimate (p.p.)') +
  xlab('')
p2

# Figure 6: worries about own economic situation ----

p2 <- soep %>% 
  filter(exclude_state == 'State excluded' & 
           outcome == 'worry_econ_own') %>% 
  ggplot(aes(end_year, estimate)) +
  geom_errorbar(aes(ymin = conf.low, 
                    max = conf.high),
                width = 0) +
  geom_hline(yintercept = 0, linetype = 'dotted') +
  geom_point(shape = 21, fill = 'white', size = 2) + 
  
  theme_bw() +
  ylab('Effect on worries about the economy') +
  xlab('Year relative to 2013') +
  coord_flip()
p2 
